﻿package ben 
{
	import caurina.transitions.Tweener;
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	/**
	 * ...
	 * @author Ben 2009
	 */
	public class Tooltip extends MovieClip
	{
		public var _txt:TextField
		public var bg1:MovieClip
		
		public function Tooltip() 
		{
			_txt.autoSize = TextFieldAutoSize.CENTER;
		}
		
		public function showTooltip(a:String)
		{
			visible = true;
			bg1.width = 2;
			bg1.x = -1;
			_txt.alpha = 0;
			_txt.text = a;
	
			Tweener.addTween(bg1, { alpha:1,x:_txt.width/2-5, width:_txt.width+10 ,time:0.2,  onComplete:showshow } );
		}
		
		public function hideTooltip()
		{
			visible = false;
		}
		
		private function showshow()
		{
			Tweener.addTween(_txt, { alpha:1, time:0.2 } );
		}
		
	}
	
}